package com.hongxun.design.bean;

import com.hongxun.design.MyApp;
import com.hongxun.design.mytools.MString;
import com.hongxun.design.mytools.ShardPreferencesTool;

/**
 * Created by zerdoor_pc on 2016/6/21.
 */
public class ConsumerInfo {

    public String user_id = "", openIdent = "", username = "", mobilePhone = "", realname = "", avatar = "", email = "", qq = "", wx = "", birthday = "", sex = "", role = "", company = "", pwd = "";
    public String loginName = "", org_id = "", org_type = "";
    public int is_vip;
    public long vip_start;
    public long vip_end;
    public long current_date;

    public void setBean(ConsumerInfo bean) {

        is_vip = bean.getIs_vip();


        vip_start = bean.getVip_start();


        vip_end = bean.getVip_end();


        current_date = bean.getCurrent_date();

        if (bean.getUser_id().length() > 0) user_id = bean.getUser_id();
        if (bean.getOpenIdent().length() > 0) {
            openIdent = bean.getOpenIdent();
//            MyApp.openIdent = "93d979ad136d140b611bdac739d01db0ef7113e790b7b82465fa06062e10ca5f2f664ba7a01bc090630bc76a2c6411b09d39698c969a0e2b";
            MyApp.openIdent = openIdent;
        }
        if (bean.getUsername().length() > 0) username = bean.getUsername();
        if (bean.getMobilePhone().length() > 0) mobilePhone = bean.getMobilePhone();
        if (bean.getRealname().length() > 0) realname = bean.getRealname();
        if (bean.getAvatar().length() > 0) {
            avatar = bean.getAvatar();
        }
        ShardPreferencesTool.saveshare(MyApp.activity, MString.login_avatar, bean.getAvatar());
        if (bean.getEmail().length() > 0) email = bean.getEmail();
        if (bean.getQq().length() > 0) qq = bean.getQq();
        if (bean.getWx().length() > 0) wx = bean.getWx();
        if (bean.getBirthday().length() > 0) birthday = bean.getBirthday();
        if (bean.getSex().length() > 0) sex = bean.getSex();
        if (bean.getRole().length() > 0) role = bean.getRole();
        if (bean.getCompany().length() > 0) company = bean.getCompany();
        if (bean.getPwd().length() > 0) pwd = bean.getPwd();
        if (bean.getOrg_id().length() > 0) org_id = bean.getOrg_id();
//        org_id="402881e9542c720401542c7d3efc0004";
        if (bean.getOrg_type().length() > 0) org_type = bean.getOrg_type();
    }

    public void clearBean() {
        user_id = "";
        openIdent = "";
        username = "";
        mobilePhone = "";
        realname = "";
        avatar = "";
        email = "";
        qq = "";
        wx = "";
        birthday = "";
        sex = "";
        role = "";
        company = "";
        pwd = "";
        org_id = "";
        MyApp.openIdent = "";
        org_type = "";
        is_vip = 0;
        vip_start = 0;
        vip_end = 0;
        current_date = 0;
        ShardPreferencesTool.saveshare(MyApp.activity, MString.logon_automatic, false);//取消自动登录
        ShardPreferencesTool.saveshare(MyApp.activity, MString.login_userpsw, "");//取消密码
    }
    public void clearThis() {
        is_vip = 0;
        vip_start = 0;
        vip_end = 0;
        current_date = 0;

    }


    public long getCurrent_date() {
        return current_date;
    }

    public void setCurrent_date(long current_date) {
        this.current_date = current_date;
    }

    public int getIs_vip() {
        return is_vip;
    }

    public void setIs_vip(int is_vip) {
        this.is_vip = is_vip;
    }

    public long getVip_end() {
        return vip_end;
    }

    public void setVip_end(long vip_end) {
        this.vip_end = vip_end;
    }

    public long getVip_start() {
        return vip_start;
    }

    public void setVip_start(long vip_start) {
        this.vip_start = vip_start;
    }

    public String getOrg_type() {
        return org_type;
    }

    public void setOrg_type(String org_type) {
        this.org_type = org_type;
    }

    public String getOrg_id() {
        return org_id;
    }

    public void setOrg_id(String org_id) {
        this.org_id = org_id;
    }

    public String getOpenIdent() {
        return openIdent;
    }

    public void setOpenIdent(String openIdent) {
        if (openIdent == null) openIdent = "";
        this.openIdent = openIdent;
    }

    public String getUser_id() {
        return user_id;
    }

    public void setUser_id(String user_id) {
        this.user_id = user_id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getMobilePhone() {
        return mobilePhone;
    }

    public void setMobilePhone(String mobilePhone) {
        this.mobilePhone = mobilePhone;
    }

    public String getRealname() {
        return realname;
    }

    public void setRealname(String realname) {
        this.realname = realname;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getQq() {
        return qq;
    }

    public void setQq(String qq) {
        this.qq = qq;
    }

    public String getWx() {
        return wx;
    }

    public void setWx(String wx) {
        this.wx = wx;
    }

    public String getBirthday() {
        return birthday;
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public String getCompany() {
        return company;
    }

    public void setCompany(String company) {
        this.company = company;
    }

    public String getPwd() {
        return pwd;
    }

    public void setPwd(String pwd) {
        this.pwd = pwd;
    }

    public String getLoginName() {
        return loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }
}
